<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <link rel="stylesheet" type="text/css" href="/css/admin_css/admin.css" />
  <script src="/js/jquery.min.js"></script>
  <title>后台登录</title>
 </head>
 <body onkeydown="on_return(event);">
 	<div class="box">
 		<div class="logo_left"></div>
		<div class="logo_right">
			<input class="account_box" placeholder="请输入用户名" value="" />
			<input class="psd_box" type="password" placeholder="请输入密码" value="" />
			<div class="btn">
				<button class="logoin_btn" onclick="check();">登录</button>
				<button class="reset_btn">重置</button>
			</div>
		</div>
 	</div>
 	<div class="hint_bg">
		<div class="hint_box">
			<p class="hint_text"></p>
			<div class="hint_btn">确定</div>
		</div>
	</div> 
	<div class="hint_bg1">
        <div class="hint_box1">
            <p class="hint_text1"></p>
            <div class="hint_btn1"></div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
//点击登录按钮
function check() {
	$.ajax({
        url:"/api/admin/login",
        type:"post",
        data:{
            "username":$('.account_box').val(),
            "password":$('.psd_box').val()
        },
        dataType:"json",
        success:function(data){
            if(data.status.errCode == 0){
				window.location.href = "{{url('admin/device/index')}}";
            }else{
            	hint(data.status.message);
            }
        }  
    });
}


//执行键盘按键命令
function on_return(e){ 
 var keycode = 0;
 //IE浏览器
 if(CheckBrowserIsIE()){
  keycode = event.keyCode;
 }else{
 //火狐浏览器
 keycode = e.which;
 }
 if (keycode == 13 ) //回车键是13
 {
  $(".logoin_btn").click();
 }
}
//判断访问者的浏览器是否是IE
function CheckBrowserIsIE(){
 var result = false;
 var browser = navigator.appName;
 if(browser == "Microsoft Internet Explorer"){
  result = true;
 }
 return result;
}




$(".reset_btn").click(function (){
	$(".account_box").val('');
	$(".psd_box").val('');
});
function hint(hint){


	$('.hint_bg').css("display","block");
	$('.hint_bg').height($(window).height()+"px");
	$('.hint_bg').width($(window).width()+"px");
	$('.hint_text').html(hint);
	$('.hint_btn').click(function(){
		$('.hint_bg').css("display","none");
	});
}
function hint1(hint1){
    if(hint1)
    {
        $('.hint_bg1').height($(window).height());
        $('.hint_bg1').css("display","block");
        $('.hint_text1').html(hint1);
        
    }
}

	
</script>
